package com.ExtendsConstructor;

public class Test2 {
    public static void main(String[] args) {
        Teacher t=new Teacher("李四",36,"java");
        System.out.println(t.getName());
        System.out.println(t.getAge());
        System.out.println(t.getSkill());
    }
}
class Teacher extends People{
    private String skill;
    public Teacher(String name,int age,String skill){
       //setName(name);太繁琐了
        super(name, age);//子类要调用父类构造器才能把对象的数据处理完整
        this.skill=skill;
    }

    public String getSkill() {
        return skill;
    }

    public void setSkill(String skill) {
        this.skill = skill;
    }
}
class People{
    private String name;
    private int age;

    public People() {
    }

    public People(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
